/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.service.stores;
import com.qinyeit.serviceapp.entity.StoreInOrder;
import com.qinyeit.serviceapp.entity.StoreInOrderDetail;
import com.qinyeit.serviceapp.entity.Warehouse;
import com.qinyetech.springstage.core.service.IBaseService;
import com.qinyeit.serviceapp.entity.Stock;

import java.util.List;
import java.util.Map;

/** 
 * ClassName: StockService <br/> 
 * Function: 库存业务功能 <br/> 
 * date: 2018-11-10 14:56:59 <br/> 
 * 
 * @author liuwenjin
 * @version 1.0
 * @since JDK 1.8
 */
public interface StockService extends IBaseService<Stock, Long>{

    /**
     * 根据仓库id和物料id 获取库存
     * @param warehouseId 仓库id
     * @param materialId 物料id
     * @param merchantGroupId 商户组id
     */
    Stock getStocks(Long warehouseId,Long materialId,Long merchantGroupId);

    /**
     * 保存库存
     * @param storeInOrder 入库单
     * @param detailList 入库单明细
     */
    void saveStore(StoreInOrder storeInOrder, List<StoreInOrderDetail> detailList);

    /**
     * 库存报表
     * @param merchantGroupId 商户id
     * @param warehouseId 库存id
     * @param materialId 物料id
     * @param keywords 关键字 （按物料名称/编码/简码/拼音码）
     * @param categoryId 类别
     * @param flag 高于最高库存 max / 低于最低库存 min
     * @return
     */
    List<Map<String,Object>> getStockList(Long merchantGroupId,Long warehouseId,Long materialId,String keywords,Long categoryId,String flag,Long storeId);

    /**
     * 根据物料获取可以使用的仓库
     * @param materialId
     * @param merchantGroupId
     * @return
     */
    List<Map<String,Object>> getWarehouses(Long materialId,Long merchantGroupId);
}